<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        /* 唐玉林209000622 */
        * {
            padding: 0;
            margin: 0;
        }

        body {
            background-color: #e0dede;
        }

        .login_box {
            width: 250px;
            height: 100px;
            text-align: center;
            border: 1px solid #ffffff;
            background-color: #ffffff;
            box-shadow: 0px 0px 2px 2px #d8d8d8;
        }

        .login-enter-to,
        .login-leave-from {
            opacity: 1;
        }

        .login-enter-active,
        .login-leave-active {
            transition: all 2s;

        }

        .login-enter-active {
            animation: loginCss 2s
        }

        .login-leave-active {
            animation: loginCss 2s reverse;
        }

        .login-enter-from,
        .login-leave-to {
            opacity: 0;
        }

        @keyframes loginCss {
            0% {
                transform: scale(0)
            }

            50% {
                transform: scale(1.2);
            }

            100% {
                transform: scale(1);
            }
        }
    </style>
</head>

<body>

    <div id="app"></div>
    <template id="root">
        <button @click="loginShow">Login动画</button>
        <transition name="login">
            <div class="login_box" v-show="show">
                <form action="#" class="login_form">
                    <div><span>账号：</span><input type="text"></div>
                    <div><span>密码：</span><input type="password"></div>
                    <input type="submit" value="登录">
                </form>
            </div>
        </transition>
    </template>
    <script>

        const app = Vue.createApp({
            template: '#root',
            data() {
                return {
                    show: false
                }
            },
            methods: {
                loginShow() {
                    this.show = !this.show
                }
            },
        })
        app.mount('#app')
    </script>
</body>

</html>